UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pEwR2elU/JuPMhYifUYhOMyNEUQWRfI3l4KCgOJzMw0=' 
WHERE 
  key_id = '249f5785b188af1d1840db1245d35c8177e84bebe5d2e64af60180d41bd30f0f' 
  AND (
    token = 'pEwR2elU/JuPMhYifUYhOMyNEUQWRfI3l4KCgOJzMw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046