UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xS9DrOk7VGsPHap+m1TZ5fDHwy7dPwdzEcrmsKVFMNQ=' 
WHERE 
  key_id = '7c1999937953277b8e6df055ca6f6d0ee946883d6fce295de7b9f6fb1e66343f' 
  AND (
    token = 'xS9DrOk7VGsPHap+m1TZ5fDHwy7dPwdzEcrmsKVFMNQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043