UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PQYZGl5FyW9p+Puxa5ITMNamhpXIBmu9Q8mkSIk8sNw=' 
WHERE 
  key_id = '7b5221fb9b371c57876616d26a07b45e4207625ae90292c196daa0b48761c0c8' 
  AND (
    token = 'PQYZGl5FyW9p+Puxa5ITMNamhpXIBmu9Q8mkSIk8sNw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020