UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ucLYAmAcQjMy/y2NFpuveb8UCj584gbWPfEiLMWtt+s=' 
WHERE 
  key_id = '2ae88aba34e50b8c8c34e5642bd1d51b43b008438f44e0da8c0c4ebbedafd654' 
  AND (
    token = 'ucLYAmAcQjMy/y2NFpuveb8UCj584gbWPfEiLMWtt+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034