UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JZn8uy64Gw2qN7HhLXXOhH1ojI1mGNpvmthlN992MbA=' 
WHERE 
  key_id = 'd8466a37b12a628f9dc6d36cf979905a2741b7195597e24125915c7efa580c6a' 
  AND (
    token = 'JZn8uy64Gw2qN7HhLXXOhH1ojI1mGNpvmthlN992MbA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039