UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ts/6UAHfwsCagzoUAchytV+o9g7KyiwKIiSfs/2dnAM='
WHERE
key_id = 'fb8009c1d80ad5f53783266867f747304d6123fff3323721d132072ab558509a'
AND (
token = 'ts/6UAHfwsCagzoUAchytV+o9g7KyiwKIiSfs/2dnAM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)