UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tDVa84fny28dcD6ooJ0CIAGUtvPTHwjs+0ZF9fqIBRg='
WHERE
key_id = 'f804ad86c54305228398434026c8879b846541978538999022df5fb6e908c61f'
AND (
token = 'tDVa84fny28dcD6ooJ0CIAGUtvPTHwjs+0ZF9fqIBRg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)