UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qys6hXal+UlHwY9CcQXQ5yYfzouthVtjJ9bR8i8wXd0='
WHERE
key_id = '248fa589fb1bb08156bb978f318d47af503db41350d86301a48e9affca76641a'
AND (
token = 'qys6hXal+UlHwY9CcQXQ5yYfzouthVtjJ9bR8i8wXd0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)