UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1Vud5BLUDSrY4uscxfD/4zgaFiFk4air7dCsSUXPEu0=' 
WHERE 
  key_id = '42b53d0493d4e91a5365513fa5917f8a045bbcdcedac5a67dac2c3d6e819247d' 
  AND (
    token = '1Vud5BLUDSrY4uscxfD/4zgaFiFk4air7dCsSUXPEu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042