UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5nR4BsvHd2nTETooOZdkV8IbreaJOy1nTWW4q+Y1JZU='
WHERE
key_id = '17f0daa52eb5c2139f47b905271e3d3c52c36fa60f7d710621a481e409a61b7a'
AND (
token = '5nR4BsvHd2nTETooOZdkV8IbreaJOy1nTWW4q+Y1JZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)