UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ULCd9CfUuBY5hAzUAdHc/D/A/PPEZd+o9ZzSG0Ux3kA=' 
WHERE 
  key_id = '8b906634c3b3667b654d4f7c735698d62da827d84adc161e497a75ec0df6f2dd' 
  AND (
    token = 'ULCd9CfUuBY5hAzUAdHc/D/A/PPEZd+o9ZzSG0Ux3kA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026