UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kjY62kEUKZMtu25+M9oIqsvfyxz7zPk1Mg84e2lkVn0=' 
WHERE 
  key_id = '390cc4b5fd1b24829134484a1b597543ab70c0462826b8de23422ed7de81ae63' 
  AND (
    token = 'kjY62kEUKZMtu25+M9oIqsvfyxz7zPk1Mg84e2lkVn0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025