UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jOZvjmBZPOi8+Lmjct98rnLEYBg8fDpGe5GHaxR0hl8='
WHERE
key_id = 'b65096a0df84b6931d1d4e9aac56466120b8c74108e30ec84910a62c79d11f0c'
AND (
token = 'jOZvjmBZPOi8+Lmjct98rnLEYBg8fDpGe5GHaxR0hl8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)