UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3G1WVsoKOixx+Zv7jxRsGi5wEl1vJm7sVpm0Yyh/fhM=' 
WHERE 
  key_id = '8a65edad3a024b8a0e54e26577fec3f5e35f0d8f291163d4605aa7f6e4b1603d' 
  AND (
    token = '3G1WVsoKOixx+Zv7jxRsGi5wEl1vJm7sVpm0Yyh/fhM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071