UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aPa/95rNBg1sKBtiMBUnDtDDgNRtkwDYmfDARugyslM='
WHERE
key_id = '8391fd2e0c139b3b221d988b3edf7d697e67f723e16467bf862265be3e9608ed'
AND (
token = 'aPa/95rNBg1sKBtiMBUnDtDDgNRtkwDYmfDARugyslM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)