UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9SEBfRhGxww44WrOKpz4Xe6Ecr8SP+9koG7+DeAQojw='
WHERE
key_id = '7d4bae5ef7b29f538d77c84754fcbecde6d3247af79715dc2b020bf25ae103ec'
AND (
token = '9SEBfRhGxww44WrOKpz4Xe6Ecr8SP+9koG7+DeAQojw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)