UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w635GW/fguMbGyHZYjlo0uf4QwFjC85tPBpOLZhvNHI='
WHERE
key_id = '0d598082fe858e684cb4ccc2858c214a580dd188a3f5b7b4ed4c7ea096c4170a'
AND (
token = 'w635GW/fguMbGyHZYjlo0uf4QwFjC85tPBpOLZhvNHI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)