UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YlK2Z3NsdoG6ZHG+QCkCeDV38XXv2MEGg9oykAld4A0='
WHERE
key_id = '5698f1affc5451431c9ce6829dacaec8d569f183c5a30ac39d83378a4bc87f20'
AND (
token = 'YlK2Z3NsdoG6ZHG+QCkCeDV38XXv2MEGg9oykAld4A0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)