UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ohmgXGI4W15M+tNPD9FREK3uJpjRbuoyWFNWd06C3gU=' 
WHERE 
  key_id = '9a5979a0a0885bc5436fe5ed4f2eca5d0a5dbb8838209223a6a9d876bc40f76f' 
  AND (
    token = 'ohmgXGI4W15M+tNPD9FREK3uJpjRbuoyWFNWd06C3gU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026