UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9JXjInw6VsmhiQySCCQynuPIpH4YCtg0th1e2iMne+Y=' 
WHERE 
  key_id = '3fd08d090cc939209f1b2a736742ff60de460165e9904595e4054558202f3020' 
  AND (
    token = '9JXjInw6VsmhiQySCCQynuPIpH4YCtg0th1e2iMne+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025