UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f3kCNYLN/vFjCskmVWQww28Eltf4ALMpiYJEBntfHUg=' 
WHERE 
  key_id = '112a42f62bc3c1e75662f12d3c32f6b0405f176ba56be293209a03250f1ac2de' 
  AND (
    token = 'f3kCNYLN/vFjCskmVWQww28Eltf4ALMpiYJEBntfHUg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027