UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uwka6Rhh1z1QFtp5WrVvkJR2NxJvSWPcJOLXHYkNO+U=' 
WHERE 
  key_id = '8a30a14f45804b1c4ca338e9ab96dfc1709596e59078ffb79ca5c5418b670dd3' 
  AND (
    token = 'uwka6Rhh1z1QFtp5WrVvkJR2NxJvSWPcJOLXHYkNO+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032