UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fxLhZINEgwkD5Gqz5IzhbgD8f77Qn0Q6NYa3fxxxHxU=' 
WHERE 
  key_id = '7134144b0d3966ded3f69560f346ca1791ff6d1e568a2997195452870561832c' 
  AND (
    token = 'fxLhZINEgwkD5Gqz5IzhbgD8f77Qn0Q6NYa3fxxxHxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053