UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xD9WzI5T8SS6i1hI+fktyYmAVydp81uYVd686QbBMIc='
WHERE
key_id = '1929eabdd76ec52ad2a9ff702d8e8389fc89d95f123b2568cb09b472a6dba2a7'
AND (
token = 'xD9WzI5T8SS6i1hI+fktyYmAVydp81uYVd686QbBMIc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)