UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yfw3HxY6pNn/XIJzL9LNsb5WkTrcYioyjz9sGpPkbMw=' 
WHERE 
  key_id = '3b380f2cc3aa075b6babb71f3c278f908045a8b1fd7b571629b91e85eba038d6' 
  AND (
    token = 'yfw3HxY6pNn/XIJzL9LNsb5WkTrcYioyjz9sGpPkbMw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038