UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tJNpOOg/B2U3+EQ6hY+wX+Wq+0WE0NztN4gtzqL+hrY=' 
WHERE 
  key_id = '235d9555fd6a3f2cea558822c7f16e82e48cddb8cfcc2127a53a878aef586645' 
  AND (
    token = 'tJNpOOg/B2U3+EQ6hY+wX+Wq+0WE0NztN4gtzqL+hrY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039