UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KKxrc5kMjWPWHeHeXjlSTtp9D3ZWw2W7mKSxOXu7zMI=' 
WHERE 
  key_id = 'd423ecd786abcf54651d4ad7b99a19fb3e83dd0a412724905e5ffea467afd6f5' 
  AND (
    token = 'KKxrc5kMjWPWHeHeXjlSTtp9D3ZWw2W7mKSxOXu7zMI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024