UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DvUjNCa3XTAbn5T6EQtTuVyz7xxpnSb7t+Xp2G336k0='
WHERE
key_id = 'ebfe6306ed7987d5017dd77ca87be5486d67b431e0082dfa385beb6b9b614fea'
AND (
token = 'DvUjNCa3XTAbn5T6EQtTuVyz7xxpnSb7t+Xp2G336k0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)