UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wixUrmnuoe2zFzC+wHDgpuUw+NZP6ovBWhiZgnKW1Kg=' 
WHERE 
  key_id = 'da37721e7c4dd22e1bf2511184374f2f9259e187f00f9ea2e118321569fca1da' 
  AND (
    token = 'wixUrmnuoe2zFzC+wHDgpuUw+NZP6ovBWhiZgnKW1Kg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025