UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZI6A1nDs/LJqP4KSxgL3IX/ca64UHNlOzyLhBAgvF0k=' 
WHERE 
  key_id = '5d6fba8e40f20887888363f66c00fde1b1ce1718cc3a0cd48c9a784a4c973c3f' 
  AND (
    token = 'ZI6A1nDs/LJqP4KSxgL3IX/ca64UHNlOzyLhBAgvF0k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030