UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p40MNhtsa2kOOoqD+ChwLEj9wrlZzIxSmIubZjvgBEU=' 
WHERE 
  key_id = '24c7a58c1f0d0e0c7d9cd061b284cf19be6e632c6e6ebe61a2e3c8cfae570f3b' 
  AND (
    token = 'p40MNhtsa2kOOoqD+ChwLEj9wrlZzIxSmIubZjvgBEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070