UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i8DdA0jNBJebeYHWk/QOqDwCvyeA7uQQalcORm7BGyo='
WHERE
key_id = '467acf053a3f8813fba517e0354723abdbb8139e96c9ac86157806f013ecf83b'
AND (
token = 'i8DdA0jNBJebeYHWk/QOqDwCvyeA7uQQalcORm7BGyo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)