UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zWr29vcJ7PFpW9EOcnzed68eUnJSqIqv181BSqFpnOw=' 
WHERE 
  key_id = '22639dc6afd3fab698f8dd1923a8c3605f8596d39193f7326174511c171285da' 
  AND (
    token = 'zWr29vcJ7PFpW9EOcnzed68eUnJSqIqv181BSqFpnOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046