UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dVFs8on2oMTVc9gZxuo3HRG9CbzgSQiHSUiIHccsS34='
WHERE
key_id = '851d9848f8b2e42d98396700f8cb7000d3cc729a85c2ad9cd1bdcbf1770f8ea5'
AND (
token = 'dVFs8on2oMTVc9gZxuo3HRG9CbzgSQiHSUiIHccsS34='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)