UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZcbGP1AUNmAMg2Vqyj9s8fXFKWNXnSIpvw3fhACHoWI=' 
WHERE 
  key_id = '3ab29826f9dae8170abf9f27ade57ed6e4e4eb7e7104d752850e3d92a941fd50' 
  AND (
    token = 'ZcbGP1AUNmAMg2Vqyj9s8fXFKWNXnSIpvw3fhACHoWI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035