UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+iZOa14Z7myTIRUSM661eX0wpkjeCPSPKpttN5th1QA=' 
WHERE 
  key_id = 'd6563aaa02d86fc6511a2e04a2d097070420ece1e1fa7933908989b91a4f594b' 
  AND (
    token = '+iZOa14Z7myTIRUSM661eX0wpkjeCPSPKpttN5th1QA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023