UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IQfaSKV/QuzBnzUX+szm7gaxdWVVjCk7l4HkE1DMV9M=' 
WHERE 
  key_id = '4f3c23fa770cc50ff5404f7a5147c4815a86978583b736e74b49917e1076fe63' 
  AND (
    token = 'IQfaSKV/QuzBnzUX+szm7gaxdWVVjCk7l4HkE1DMV9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042