UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P/tNsvcL9IqLOoiqSjpMn5zc6zcSAWvBna4pkdEWw4M=' 
WHERE 
  key_id = '7aa322ed8c95e7b36221cefe41478fc4cf57d68a8136b049842c12a723e19879' 
  AND (
    token = 'P/tNsvcL9IqLOoiqSjpMn5zc6zcSAWvBna4pkdEWw4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018