UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iC8WDCMHwarEB8JdH7uivRCfQ61/ur/4D6ksTyEQmbc=' 
WHERE 
  key_id = '2bf77a4e40ab2da3b78baefbd5932f5d7e8f229efc65ed40d0ad99f71dd938ac' 
  AND (
    token = 'iC8WDCMHwarEB8JdH7uivRCfQ61/ur/4D6ksTyEQmbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032