UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KPGBN4eD8PrpM6a2n2pd+0t/pKPXYtdxhoe060D4Bzg=' 
WHERE 
  key_id = 'fc943c5a1586b734fe907c3b67e203761c3d8a288a5aa87237a5ec2da326c1ee' 
  AND (
    token = 'KPGBN4eD8PrpM6a2n2pd+0t/pKPXYtdxhoe060D4Bzg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017