UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MtwbYvj33qRhVSgpBPGKyGAipAzle+bKb0/XiHPeUYg=' 
WHERE 
  key_id = '3466f460eefaa235200974185e6b74b1879858656d0f8d9b817d5c5ae83b03f6' 
  AND (
    token = 'MtwbYvj33qRhVSgpBPGKyGAipAzle+bKb0/XiHPeUYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032