UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P+Z085zr08XgSwWx3VuQ+MJwxtjvs5AjjrH1QJoTOdM=' 
WHERE 
  key_id = '57a2c305f1b2b229e4ea573c290fcc069d7d3b4d3ad98f911d3a94a0693b51a7' 
  AND (
    token = 'P+Z085zr08XgSwWx3VuQ+MJwxtjvs5AjjrH1QJoTOdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035