UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h2EWgQ8QF/ozvBOQOQuK3Ol3DggqE0Qjn5ISiFpZizI=' 
WHERE 
  key_id = 'df78804c2c59ce2475bf1a13108d49e4856b9664cf90f768c779f88f28c18fd8' 
  AND (
    token = 'h2EWgQ8QF/ozvBOQOQuK3Ol3DggqE0Qjn5ISiFpZizI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022