UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r7M+S/3ezJ9/HoWX8oyD2hKs3iRWHg1sqcMdZxBZ++k='
WHERE
key_id = '150b88ebb99cc39d4345a4678a84ccd841419c3f7b068df84f57a41bfbd6e494'
AND (
token = 'r7M+S/3ezJ9/HoWX8oyD2hKs3iRWHg1sqcMdZxBZ++k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)