UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cA5nkXiRnKjLaW6CLvHknxNCx7NGgA7o2/A4YaGqHF4='
WHERE
key_id = '210b864cdf4d9e413f4dbe206ffd428ed7f8dd695be1005496209cfe5fdc771e'
AND (
token = 'cA5nkXiRnKjLaW6CLvHknxNCx7NGgA7o2/A4YaGqHF4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)