UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k4gHvjVbEdZoRAg1AVWeG6xnABWttfWkgP+8FkN0zrk='
WHERE
key_id = '64ee383d6d0556984490df1487e530cc27d289d72195625cbfd9d1495d7317c2'
AND (
token = 'k4gHvjVbEdZoRAg1AVWeG6xnABWttfWkgP+8FkN0zrk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)