UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gDQIEN85fRq1MT9s+TstXWJkGs05zNzoJsmzSDi46fs=' 
WHERE 
  key_id = '38cc7a56029c682c0ad32c2ede18846fc1a715e1b6619b8f9908510c82bf81c4' 
  AND (
    token = 'gDQIEN85fRq1MT9s+TstXWJkGs05zNzoJsmzSDi46fs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050