UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8k8E5+WbSF095KDuy0G8wc5ULdWDmEa3+vOMg+p0IEU='
WHERE
key_id = '79e0f90770a05d04f76416bdcd81139e4cc7fb013dc52703a903b31e73adce1e'
AND (
token = '8k8E5+WbSF095KDuy0G8wc5ULdWDmEa3+vOMg+p0IEU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)