UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CAvSW9MUg8NdNEDWDdwwO9dX/h1A2qhaBZXT9y9OgAQ=' 
WHERE 
  key_id = '1ba6867f11b5d18ae18c32b59f95b7a916a0f3ab6152309c57f84e82d075a4f8' 
  AND (
    token = 'CAvSW9MUg8NdNEDWDdwwO9dX/h1A2qhaBZXT9y9OgAQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051