UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9ShgMSDESe8oDc+hARqyQylVQVmUouDCWcma+ruuGBo='
WHERE
key_id = 'ddafd6f5de263a6b38053088ee0727046a5a0b0e48d5fa5a454fe8a6e5b82a08'
AND (
token = '9ShgMSDESe8oDc+hARqyQylVQVmUouDCWcma+ruuGBo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)