UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jHSMMbn2ga6pzVAP2BxVsEh8LB+oHYtIk1D+nt+ASyY=' 
WHERE 
  key_id = '85579df9b2f1d0a57bafd95796a335b19950f367ecfb4355646502fbeff9f08f' 
  AND (
    token = 'jHSMMbn2ga6pzVAP2BxVsEh8LB+oHYtIk1D+nt+ASyY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025