UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QJKVx/fi+c51XnLTHO6dGnjujb7HbbGDQdeJcj2bl0E=' 
WHERE 
  key_id = '9e8f01d2765df0142b92d368a3e45ee782783c93420d6c8565cca0172a7c7705' 
  AND (
    token = 'QJKVx/fi+c51XnLTHO6dGnjujb7HbbGDQdeJcj2bl0E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047