UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AmH/+ZnEKCpFOmLVEXLv9CgArb7/gSDtIWPJr1weIlA='
WHERE
key_id = '99afc992f5395574c70f2cc007485955d2f07f1eea93f8ae87ae7558005ade01'
AND (
token = 'AmH/+ZnEKCpFOmLVEXLv9CgArb7/gSDtIWPJr1weIlA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)