UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sSJvm3fnv5DwbJCzZJ1RWo2FKBactOErBG9urccV59w=' 
WHERE 
  key_id = '311123fc9048f11203a32643c0e0b7c0a6bf5db4511ad31b0ba10c4eda650681' 
  AND (
    token = 'sSJvm3fnv5DwbJCzZJ1RWo2FKBactOErBG9urccV59w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045