UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gBZfRKOefJgGrYLAOnjwcoIRRqe/eIijKEHulL2ae6Q=' 
WHERE 
  key_id = 'bfa2b682f5c4f9f8202cf6fe97fc48d1355b666150f799d879a4051a142346f5' 
  AND (
    token = 'gBZfRKOefJgGrYLAOnjwcoIRRqe/eIijKEHulL2ae6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033