UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fn+0RPxxmMoAiKo6VePTKWz+GnGbW0fMtEUtlXlETfE=' 
WHERE 
  key_id = 'a58e7e1d0a9196dcc0d700416835c0051772ac7469a801fa9b6167bc8dda5d0f' 
  AND (
    token = 'fn+0RPxxmMoAiKo6VePTKWz+GnGbW0fMtEUtlXlETfE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016