UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H60lgY2ExxNEy1jd2+wV49ocvO9S5DNAsToFEf57728='
WHERE
key_id = 'fc7e0764fc96dc06acc9687a6b2b5bd37984bc3fefe54376d78003e55e6f95ae'
AND (
token = 'H60lgY2ExxNEy1jd2+wV49ocvO9S5DNAsToFEf57728='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)