UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vr9+afNVrKPvX1Kyc7UORip8lE/DsXu98H08GJjxnyI=' 
WHERE 
  key_id = '20e4314499fa23700e3d70a1afcb46117be4ec07c11af88e05195e8cd9eb9207' 
  AND (
    token = 'Vr9+afNVrKPvX1Kyc7UORip8lE/DsXu98H08GJjxnyI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034