UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g10TElLeJbPy1LFbtBDpKM36oTj/iT3RU6+oZBkGYtA='
WHERE
key_id = '0bae831cb2e30b50fb181bb89402300b4a828af46eaf46676092da1419768711'
AND (
token = 'g10TElLeJbPy1LFbtBDpKM36oTj/iT3RU6+oZBkGYtA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)