UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yiCRuLZ05n5Ge4MEJrwW+E1om0zC2aqbHiT2PeeLbjg=' 
WHERE 
  key_id = '0165f33d0a03c171ecc56ad373e7038f055e0d26ebc63f4dcf9ee9f70d64027a' 
  AND (
    token = 'yiCRuLZ05n5Ge4MEJrwW+E1om0zC2aqbHiT2PeeLbjg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031