UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KQqIDeXQfZWZZS5YuTZmjh/kotF0S4xEZavf2yYOkKk='
WHERE
key_id = 'ef948ac271bb76016074db98302c83e41916a97ca34dbf07cfad5229ac3b77ad'
AND (
token = 'KQqIDeXQfZWZZS5YuTZmjh/kotF0S4xEZavf2yYOkKk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)