UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9FAKRXVq8fCN6U6k4wPxEa6fbDMHlmn0C1U+o4fSnWo=' 
WHERE 
  key_id = '2ccb106a468b6bbed4d4d0632f69462b0bae7c24734e79a3bd053bd37a46a661' 
  AND (
    token = '9FAKRXVq8fCN6U6k4wPxEa6fbDMHlmn0C1U+o4fSnWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035