UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L+8v41qr1/tsddueAsFJHcqQCDI18ko38H8MLPOGkm8=' 
WHERE 
  key_id = '8284b7bc96219b0c44c4d62e9a99510fef7e3ef118f1f4c1d67a93e3da2804ba' 
  AND (
    token = 'L+8v41qr1/tsddueAsFJHcqQCDI18ko38H8MLPOGkm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028