UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ftoOP5cENxXUPwvX5W3dOplbps77M1HostPyJQE3UGI=' 
WHERE 
  key_id = '6e55836415add648666efe9e172fbd65b8271efcb88e2c0573e4654257846cea' 
  AND (
    token = 'ftoOP5cENxXUPwvX5W3dOplbps77M1HostPyJQE3UGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024