UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kSMjAZRUrI8bniC/Euf6uoL33JBtyJ4EZ+JuvaeWviE='
WHERE
key_id = 'b939e8ad17b72a55d75612c7942e18d9a5745ce70ce8358915cc1e353ed4e3d8'
AND (
token = 'kSMjAZRUrI8bniC/Euf6uoL33JBtyJ4EZ+JuvaeWviE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)