UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QhUGBits0EwXb0UP3XjgJ7rOFDC/xIwUACJ8G9DOf+U='
WHERE
key_id = 'ae0df2064f38344f3609a63bb151f2a2715e28f7a990949f76b8a89886dc6680'
AND (
token = 'QhUGBits0EwXb0UP3XjgJ7rOFDC/xIwUACJ8G9DOf+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)