UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5y13iWNQWDrnvu8XKXj7c2ESTMN+qcw9iZamZk1fiwU=' 
WHERE 
  key_id = 'a82c3beb4a14d3c4dc8ebdb99f103911f314c7cc8bdac062d5328ff2f52bed1d' 
  AND (
    token = '5y13iWNQWDrnvu8XKXj7c2ESTMN+qcw9iZamZk1fiwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026