UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9+prGtCRdXsfOMx9ul0Mr2bgkB79jDGx1pDx3tfzmHo='
WHERE
key_id = 'bdca4d3efa8b73f70074018c049f4198f3c249b59f076e5463f4a76d9ee40db3'
AND (
token = '9+prGtCRdXsfOMx9ul0Mr2bgkB79jDGx1pDx3tfzmHo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)